package com.xliee.modules.problem.controller;

import com.xliee.modules.problem.entity.ProblemEntity;
import com.xliee.modules.problem.service.IProblemService;
import com.xliee.modules.sys.entity.UserEntity;
import com.xliee.modules.vehicle.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lisongsong@xliee.com
 * @since 2024-09-05 10:19:00
 */
@Controller
@RequestMapping("/problem")
public class ProblemController {

    @Autowired
    IProblemService problemService;


    /**
     * 日常问题列表
     * @param problem
     * @param model
     * @return
     */
    @RequestMapping("/list")
    public String list(ProblemEntity problem,Model model) {
        List<ProblemEntity> list =  problemService.list();
        model.addAttribute("list",list);
        model.addAttribute("problem",problem);
        return "problem/listPage";
    }

    /**
     * 快速添加日常问题
     * @param problem
     * @param model
     * @return
     */
    @RequestMapping("/doAddQuickly")
    public String doAddQuickly(ProblemEntity problem,Model model) {
        problemService.doAddQuickly(problem);
        return "redirect:/index";
    }



}
